package com.wsc.juc_001.c_005;

/**
 * 分析程序输出
 * 1.实现runnable接口，但是方法没有用Synchronized修饰：count不按--输出
 *
 */
public class Synchronized_05 implements Runnable {
    public int count = 100;
    @Override
    public  synchronized  void run() {
            count--;
            System.out.println(Thread.currentThread().getName()+ " count = " + count);
    }


    public static void main(String[] args) {
        Synchronized_05 synchronized_05 = new Synchronized_05();
        for (int i = 0; i <100 ; i++) {
            new Thread(synchronized_05).start();
        }
    }
}